﻿<UserControl x:Class="BlackjackBot.Wpf.Controls.PlayerControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:wpf="clr-namespace:BlackjackBot.Wpf"
             mc:Ignorable="d">
    <Grid Height="80" VerticalAlignment="Top" HorizontalAlignment="Left">
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="130"/>
			<ColumnDefinition Width="80"/>
			<ColumnDefinition Width="430"/>
			<ColumnDefinition Width="10"/>
			<ColumnDefinition Width="100"/>
			<ColumnDefinition Width="50"/>
			<ColumnDefinition Width="50"/>
			<ColumnDefinition Width="50"/>
		</Grid.ColumnDefinitions>
		<TextBlock Grid.Column="0"  VerticalAlignment="Center" Name="txtPlayerName" Margin="5,0,10,0" Style="{StaticResource PrimaryText2}" HorizontalAlignment="Left" Text="{Binding Name}" />
			<Grid Grid.Column="1" Margin="0,0,10,0" VerticalAlignment="Top" Visibility="{Binding IsDealer, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Invert}">
				<Image Source="/Images/chip.png" Width="70" Height="70" Margin="0,1,0,0" />
				<TextBlock TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Bet, StringFormat={}{0:C}}" Style="{StaticResource PrimaryText2}" FontWeight="Bold" Margin="0,2,0,0" />
			</Grid>

			<ItemsControl Grid.Column="2" Height="72" Style="{StaticResource TransparentItems}" ItemsSource="{Binding Hand, Converter={StaticResource HandToItemConverter}}">
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<WrapPanel IsItemsHost="True" />
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
				<ItemsControl.ItemTemplate>
					<DataTemplate>
						<Image Source="{Binding}"/>
					</DataTemplate>
				</ItemsControl.ItemTemplate>
			</ItemsControl>
			<TextBlock Grid.Column="4" VerticalAlignment="Center" Name="txtPlayerBank" Margin="5,0,10,0" Style="{StaticResource PrimaryText2}" HorizontalAlignment="Right" Text="{Binding Balance, StringFormat={}{0:C}}" Visibility="{Binding IsDealer, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Invert}"/>
			<TextBlock Grid.Column="5" VerticalAlignment="Center" Name="txtPlayerWin" Margin="10,0" Style="{StaticResource PrimaryText2}" Text="{Binding Wins}" Visibility="{Binding IsDealer, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Invert}"/>
			<TextBlock Grid.Column="6" VerticalAlignment="Center" Name="txtPlayerLost" Margin="10,0" Style="{StaticResource PrimaryText2}" Text="{Binding Losses}" Visibility="{Binding IsDealer, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Invert}"/>
			<TextBlock Grid.Column="7" VerticalAlignment="Center" Name="txtPlayerPush" Margin="10,0" Style="{StaticResource PrimaryText2}" Text="{Binding Pushes}" Visibility="{Binding IsDealer, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Invert}"/>

			<Grid HorizontalAlignment="Right" Grid.ColumnSpan="8" Margin="0,0,6,0" Visibility="Hidden">
				<Image Source="/BlackjackBot.Wpf;component/images/ResultWon.png" HorizontalAlignment="Right" VerticalAlignment="Center" Height="60" Width="146" />
				<TextBlock Style="{StaticResource PlayerResultText}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">Win</TextBlock>
			</Grid>
		</Grid>
	    
		<Image Source="/BlackjackBot.Wpf;component/images/CardTableRowDivider.png" Height="2" VerticalAlignment="Bottom" Stretch="Fill"  />
	    
	</Grid>
</UserControl>
